import 'dart:io';

import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import '../platform_service.dart';
import 'platform_service_method_channel.dart';

abstract class PlatformServicePlatform extends PlatformInterface {
  /// Constructs a PlatformServicePlatform.
  PlatformServicePlatform() : super(token: _token);

  static final Object _token = Object();

  static PlatformServicePlatform _instance =
      PlatformServicePlatform._setPlatform();

  /// The default instance of [PlatformServicePlatform] to use.
  ///
  /// Defaults to [MethodChannelPlatformService].
  static PlatformServicePlatform get instance => _instance;

  /// Platform-specific implementations should set this with their own
  /// platform-specific class that extends [PlatformServicePlatform] when
  /// they register themselves.
  static set instance(PlatformServicePlatform instance) {
    PlatformInterface.verifyToken(instance, _token);
    _instance = instance;
  }

  /// web 平台会自己走 set instance
  factory PlatformServicePlatform._setPlatform() {
    if (Platform.isAndroid || Platform.isIOS) {
      var ncPlatformService = MethodChannelPlatformService();
      return ncPlatformService;
    } else {
      throw UnimplementedError(
        'The current platform "${Platform.operatingSystem}" is not supported by this plugin.',
      );
    }
  }

  Future<String?> getPlatformVersion() {
    throw UnimplementedError('platformVersion() has not been implemented.');
  }

  Future<NDFileInfo?> takePicture(
      {bool isWaterMark = false,
      bool isWaterMarkTiled = false,
      List<ImageWaterMarkSettingModel>? waterMarkSettings}) {
    throw UnimplementedError('platformVersion() has not been implemented.');
  }

  Future<List<NDFileInfo>> pickImages(
      {int maxCount = 8,
      bool enableCamera = false,
      bool isWaterMark = false,
      bool isWaterMarkTiled = false,
      List<ImageWaterMarkSettingModel>? waterMarkSettings}) {
    throw UnimplementedError('platformVersion() has not been implemented.');
  }

  Future<NDFilePickerResult> pickFile() {
    throw UnimplementedError('platformVersion() has not been implemented.');
  }
}
